import {
    GETDANQURES,
    GETGESHOURES,
    GETZHUANJIRES,
    GETGEDANRES
} from "../constants";

const INITSTATE = {
    danquRes: [],
    geshouRes: [],
    zhaunjiRes: [],
    gedanRes: []
};
export default function (prestate = INITSTATE, action) {

    const {
        type,
        data
    } = action;
    const obj = Object.assign({}, prestate);

    switch (type) {
        case GETDANQURES:
            obj.danquRes = data;
            return obj;
            break;
        case GETGESHOURES:
            obj.geshouRes = data;
            return obj;
            break;
        case GETZHUANJIRES:
            obj.zhaunjiRes = data;
            return obj;
            break;
        case GETGEDANRES:
            obj.gedanRes = data;
            return obj;
            break;
        default:
            return prestate;
            break;
    }
}